﻿using System;
using System.Collections.Generic;
using System.Linq;
using EzDesk.Core.Model;
using EzDesk.Core.ServiceImpl.Filters;
using EzDesk.Core.Interface;

namespace EzDesk.Core.ServiceImpl.Services
{
    public partial class CoreService : ICoreService
    {
        App ICoreService.RegistApp(string appName)
        {
            throw new NotImplementedException();
        }

        void ICoreService.DeleteApp(App app)
        {
            throw new NotImplementedException();
        }

        IList<App> ICoreService.GetAllApps()
        {
            return _appRepository.GetAll()
                .ToList();
        }

        App ICoreService.GetAppByName(string appName)
        {
            var app = _appRepository.GetAll()
               .ByName(appName);
            if (app == null)
            {
                throw new Exception("App does not exist!");
            }
            return app;
        }

        App ICoreService.GetAppById(Guid appId)
        {
            return _appRepository.GetById(appId);
        }



    }
}
